package com.ssd.controller.consumer;


import com.ssd.entity.GiftExchange;
import com.ssd.service.IGiftExchangeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController("consumerGiftExchangeController")
@RequestMapping("/consumer/giftExchange")
@Api(tags = "用户端-礼品记录表控制器")
@Validated
public class GiftExchangeController {

    @Resource
    private IGiftExchangeService giftExchangeService;


    /**
     * 查询用户兑换记录列表
     *
     * @return
     */
    @ApiOperation(value = "查询兑换记录列表")
    @GetMapping("/queryGiftExchangeList")
    public List<GiftExchange> queryGiftExchangeList(@RequestParam(value = "lastId", required = false) Long lastId) {
        return giftExchangeService.queryGiftExchangeList(lastId);
    }


    /**
     * 用户端确认收货
     * @param id 兑换礼品id
     */
    @ApiOperation(value = "确认收货")
    @GetMapping("/confirmReceipt/{id}")
    public void confirmReceipt(@PathVariable("id") Long id) {
        giftExchangeService.confirmReceipt(id);
    }

}
